import java.util.Scanner;

public class Client {
	public static void main(String[] args) {
		int elem = 0;
		String element = "0";
		int pos = 0;
		System.out.println("Problema 1");
		// VECTOR//
		System.out
				.println("Dati lungimea vectorului !!!\nTastati 'x' pentru a opri introcucerea !");
		Scanner nr_e = new Scanner(System.in);
		int nr_elem = nr_e.nextInt();
		Vector v = new Vector(nr_elem);
		while ((!element.equals("x")) && (pos < nr_elem)) {
			System.out.println("Introduceti elementul de pe pozitia: " + pos);
			pos++;
			Scanner nr = new Scanner(System.in);
			element = nr.next();
			if (!element.equals("x")) {
				elem = Integer.parseInt(element);
				v.adauga(elem);
			}
			if (element.equals("x")) {
				System.out.println("Ati terminat de introdus !!!");
			}
		}
		System.out.println(v.toString());
		System.out.println("Dati elementul de sters !!!");
		Scanner nr_s = new Scanner(System.in);
		int s_elem = nr_s.nextInt();
		v.sterge(s_elem);
		System.out.println(v.toString());
		System.out.println("Dati pozitia elementului de afisat !!!");
		Scanner nr_r = new Scanner(System.in);
		int r_elem = nr_r.nextInt();
		v.returneaza(r_elem);
		// VECTOR//
		// LISTA//
		System.out.println();
		System.out
				.println("Adaugati elemente in lista !\nTastati 'x' pentru a opri introcucerea !");

		Lista l = new Lista();
		for (int posl = 0; !element.equals("x"); posl++) {
			Scanner nr = new Scanner(System.in);
			element = nr.next();
			if (!element.equals("x")) {
				System.out.println("Element introdus pe pozitia: " + posl);
				int elem_l = Integer.parseInt(element);
				l.adauga(elem_l);
			}
			if (element.equals("x")) {
				System.out.println("Ati terminat de introdus !!!");
			}
		}
		System.out.println(l.toString());
		System.out.println("Dati elementul de sters !!!");
		Scanner nr_sl = new Scanner(System.in);
		int s_list = nr_sl.nextInt();
		l.sterge(s_list);
		System.out.println(l.toString());
		System.out.println("Introduceti un element la o pozitie !");
		System.out.println("Introduceti pozitia !");
		Scanner pos_l = new Scanner(System.in);
		int pos_el = pos_l.nextInt();
		System.out.println("Introduceti elementul !");
		Scanner e_l = new Scanner(System.in);
		int e_el = e_l.nextInt();
		l.inserare(pos_el, e_el);
		System.out.println(l.toString());
		// LISTA//
		// MULTIME//
		System.out.println();
		System.out.println("Introduceti elementele multimilor !");
		System.out
				.println("Introduceti numarul de elementele ale primei multimi !");
		Scanner nr1 = new Scanner(System.in);
		int nr_m1 = nr1.nextInt();
		Multime m1 = new Multime(nr_m1);
		System.out.println("Introduceti elementele !");
		for (int i = 0; i < nr_m1; i++) {
			System.out.print("m1[" + i + "]=");
			Scanner nr_e1 = new Scanner(System.in);
			int e1 = nr_e1.nextInt();
			m1.adauga(e1);
		}

		System.out
				.println("Introduceti numarul de elementele ale celei de a doua multime !");
		Scanner nr2 = new Scanner(System.in);
		int nr_m2 = nr2.nextInt();
		Multime m2 = new Multime(nr_m2);
		System.out.println("Introduceti elementele !");
		for (int i = 0; i < nr_m2; i++) {
			System.out.print("m2[" + i + "]=");
			Scanner nr_e2 = new Scanner(System.in);
			int e2 = nr_e2.nextInt();
			m2.adauga(e2);
		}
		System.out.println();
		System.out.println(m1.toString());
		System.out.println(m2.toString());
		System.out.println();
		System.out
				.println("Introduceti elementul de sters din prima multime !");
		Scanner nr_s1 = new Scanner(System.in);
		int nrs_m1 = nr_s1.nextInt();
		m1.sterge(nrs_m1);
		System.out
				.println("Introduceti elementul de sters din a doua multime !");
		Scanner nr_s2 = new Scanner(System.in);
		int nrs_m2 = nr_s2.nextInt();
		m2.sterge(nrs_m2);
		System.out.println();
		System.out.println(m1.toString());
		System.out.println(m2.toString());
		m1.reuniune(m1, m2);
	}
}
